<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/rp/common/taglib.jsp" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <base href="<%=basePath%>">
    
    <title>登录日志管理</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	
	<script src="rp/scripts/boot.js" type="text/javascript"></script>
	
	<style type="text/css">
	   	
    </style>
	
  </head>
  
  <body class="body-fit">
  	
  	<div style="width:100%;">
        <div class="mini-toolbar" style="padding:0px;border-top:0;border-left:0;border-right:0;">
            <table style="width:100%;">
                <tr>
                    <td style="width:100%;">
                        <sec:authorize ifAllGranted="AUTH_SUPERADMIN">
                        	<a class="mini-button mini-button-danger" onclick="removeAll()"><i class="fa fa-trash-o fa-lg"></i> 清空所有记录</a>
                        </sec:authorize>      
                    </td>
                    <td style="white-space:nowrap;">
                    	
                    </td>
                </tr>
            </table>           
        </div>
    </div>
    <div class="mini-fit">
	  	<div id="loginLogGrid" class="mini-datagrid" style="width: 100%; height:100%;" borderStyle="border:0;"
	    	url="rp/system/loginLogMng/getLoginLogsByPage" idField="id"
	    	pageSize="20" allowResize="false">
		    <div property="columns">
		        <div type="indexcolumn" headerAlign="center">序号</div>
		        <div name="ip" field="ip" width="" headerAlign="center">
		        	IP地址
		        </div>    
		        <div name="username" field="username" width="120" headerAlign="center">
		        	用户名
		        </div> 
		        <div name="realname" field="realname" width="120" headerAlign="center">
		        	姓名
		        </div>
		        <div field="createDate" width="100" headerAlign="center" allowSort="true" renderer="onDateRenderer">
		        	登录日期
		        </div>                
		    </div>
		</div>
	</div>
  	
	<script type="text/javascript">
		var grid;
	
		$(function(){
			grid = mini.get("loginLogGrid");
			grid.load();
		});
		
		function removeAll(){
			mini.confirm("确定删除记录吗？", "友情提示",
	            function (action) {
	                if (action == "ok") {
	                	rp_ajax("rp/system/loginLogMng/removeAll",{},function(result){
	                		if(result == "success"){
		    					mini.alert("已清空所有日志记录");
		    					grid.reload();
		    				}
	        			});
	                }
	            }
	        );
			
		}
	</script>
  </body>
</html>
